#!user/bin/env python3
# -- coding: utf-8 --
# @Createtime：2023/8/29 16:20
# @Updatetime：16:20
# @Author：Test008
# @File：9-鼠标事件
# @Description：
import time

from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys

driver = webdriver.Chrome()
driver.get('https://www.baidu.com')  # 打开一个懒加载的页面
driver.maximize_window()
driver.implicitly_wait(3)

# 在百度的输入框输入内容，退格，全选，复制粘贴，回车操作
ele = driver.find_element(By.CSS_SELECTOR, '#kw')
ele.send_keys('水帘洞美猴王齐天大圣孙悟空')
time.sleep(2)
ele.send_keys(Keys.BACK_SPACE)
time.sleep(2)
ele.send_keys(Keys.CONTROL, 'a')    # 组合键control+a
time.sleep(2)
ele.send_keys(Keys.CONTROL, 'c')    # 组合键control+c
ele.send_keys(Keys.CONTROL, 'v')    # 组合键control+v
ele.send_keys(Keys.ENTER)
